import Vue from 'vue';
import VueRouter from 'vue-router';
import Login from '../views/Login.vue';
import { getToken } from '../utils/auth.js'

Vue.use(VueRouter);

const routes = [
  {
    path : "/login",
    name : "login",
    component: Login
  },
  {
    path : "/",
    name : "home",
    redirect : "/index",
    component: () => import('../views/Home.vue'),
    children : [
      {
        path : "index",
        name : "index",
        component: () => import('../views/Index.vue'),
      }
    ]
  },
  {
    path : "/member",
    name : "home",
    component: () => import('../views/Home.vue'),
    children : [
      {
        path : "/",
        name : "member",
        component: () => import('../views/Member.vue'),
        meta :{
          title: '会员管理'
        }
      }
    ]
  },
  {
    path : "/supplier",
    name : "home",
    component: () => import('../views/Home.vue'),
    children : [
      {
        path : "/",
        name : "supplier",
        component: () => import('../views/Supplier.vue'),
        meta: {
          title: '供应商管理'
        }
      }
    ]
  },
  {
    path : "/goods",
    name : "home",
    component: () => import('../views/Home.vue'),
    children : [
      {
        path : "/",
        name : "goods",
        component: () => import('../views/Goods.vue'),
        meta : {
          title : '商品管理'
        }
      }
    ]
  },
  {
    path : "/staff",
    name : "home",
    component: () => import('../views/Home.vue'),
    children : [
      {
        path : "/",
        name : "staff",
        component: () => import('../views/Staff.vue'),
        meta: {
          title: '员工管理'
        }
      }
    ]
  }
];

const router = new VueRouter({
  routes,
});
export default router;
